home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / program / misc / xlist_s.lha / xlist_s / xList_104.s next >
Text File  |  1995-09-11  |  26KB  |  1,498 lines

  1. ; xList.s v1.04 (26.09.95)   (guide in util/misc/xList104.lha)
  2. ; Needs OS v37+ (or v39? not tested on v37)
  3. ; freely distributable,modifiable,trashable ==> adapt it to your needs !
  4.  
  5. ; Recently written parts are not commented, it is total disorder !
  6. ; (but label names can be helpful)
  7.  
  8.     include    "dos/dos.i"
  9.     include    dos/var.i
  10.     include    lvo/lvos.i ; all the _LVO equates
  11.     include    exec/types.i
  12.  
  13. CALL    MACRO
  14.     jsr    _LVO\1(a6)
  15.     ENDM
  16.  
  17. ; kind of XpkHeader structure
  18.       STRUCTURE XpkHeader,0
  19.          ULONG xh_Reco  ;0 usually 'XPKF'
  20.          ULONG xh_CLen  ;4 Crunched size
  21.          ULONG xh_Type  ;8 sublibrary (NUKE,SQSH,...)
  22.          ULONG xh_ULen  ;12 Uncrunched size
  23.          UBYTE xh_Sample ;16 (1st char of 16 bytes of the uncrunched file)
  24.          LABEL xheadlen ; old lenght of infos to be read (now read more datas)
  25.  
  26. ; the Stonecracker Header
  27.       STRUCTURE StcHeader,0
  28.          ULONG stc_Version   ; only test 'S404'
  29.          ULONG stc_SecurLen
  30.          ULONG stc_UnpackLen
  31.          ULONG stc_CrunchLen
  32.          LABEL dummysize1
  33.  
  34. ; the Crunchmania Header
  35.       STRUCTURE CrmHeader,0
  36.          ULONG crm_Version
  37.          UWORD crm_Check
  38.          ULONG crm_UnpackLen
  39.          ULONG crm_CrunchLen
  40.          LABEL dummysize2
  41.  
  42. ; the Lha header
  43.       STRUCTURE LhaHeader,0
  44.          UWORD lha_garbage ;0 dunno what is it
  45.          UBYTE lha_id0 ;2  '-'
  46.          UWORD lha_id1 ;3 'lh'
  47.          UWORD lha_id2 ;5 'n-' 0<=n<=5
  48.          UBYTE lha_clen3 ;7 lenghts inverted. dunno why...
  49.          UBYTE lha_clen2 ;8
  50.          UBYTE lha_clen1 ;9
  51.          UBYTE lha_clen0 ;10
  52.          UBYTE lha_ulen3 ;11
  53.          UBYTE lha_ulen2 ;12
  54.          UBYTE lha_ulen1 ;13
  55.          UBYTE lha_ulen0 ;14
  56.          ULONG lha_chksum ;15 perhaps checksum? dunno
  57.          UWORD lha_chksum2 ;19 =$2001 if done with lha on Unix
  58.          UBYTE lha_namesize ;21 lenght of filename - last byte useful for lha
  59.          UBYTE lha_char1 ;22 first char of filename
  60.          UBYTE lha_char2 ;23
  61.          ULONG lha_chars3 ;24 dummy ulongs...
  62.          ULONG lha_chars4 ;28
  63.          LABEL lha_size ;32 the new lenght of data - useful for XPK (modname)
  64.  
  65. ;A3-relative table offsets
  66.       STRUCTURE Variables,0
  67.          ULONG args_result ; null offset removed (optimisation)
  68.          ULONG pplast
  69.          ULONG headbuf
  70.          ULONG Packlib
  71.          ULONG strloc
  72.          ULONG oldlock
  73.          ULONG strloc2
  74.          ULONG utot
  75.          ULONG dirs ; DIRS/M
  76.          ULONG switch1 ; IT=INTROTEXT/K
  77.          ULONG switch2 ; NT=NOTOTALS/S
  78.          ULONG switch3 ; TR=TESTRIPP/S
  79.          ULONG switch4 ; TD=TESTDURATION/S
  80.          ULONG switch5 ; ET=ENDTEXT/K
  81.          ULONG switch6 ; NOSORT/S
  82.          ULONG switch7 ; NH=NOHEADER/S
  83.          ULONG switch8 ; FO=FILESONLY/S
  84.          ULONG switch9 ; FP=FULLPATH/S
  85.          ULONG switch10 ; H2=HEADER2/S
  86.          ULONG switch11 ; LF/S (put 2 linefeeds at end)
  87.          ULONG switch12 ; DL=DRAWLIMITS/S
  88.          ULONG switch13 ; COF=COUNTONLYFILES/S
  89.          ULONG switch14 ; SN=SONGNAME/S
  90.          ULONG numfiles
  91.          ULONG numdirs
  92.          ULONG ctot
  93.          ULONG itfh
  94.          ULONG itlock
  95.          ULONG itsize
  96.          ULONG itbuffer
  97.          ULONG tmpfh
  98.          ULONG tmpnameptr
  99.          ULONG fh
  100.          ULONG ofh
  101.          ULONG seglist
  102.          ULONG varfh
  103.          ULONG sumvarbuff
  104.          ULONG longsum
  105.          ULONG numfiles_buffer
  106.          ULONG tmp_lhsize
  107.          ULONG lh_utot
  108.           BOOL entrytype
  109.          UWORD spcecnt
  110.           BOOL tmpdeleted
  111.           BOOL atleastone
  112.           BOOL sortflag
  113.           BOOL onlydirs ; 0=dirs \ 1=files+dirs
  114.           BOOL namegiv_bool
  115.           BOOL xpked
  116.          LABEL vars_sizeof ; total size of the array above
  117.  
  118.  
  119. ;output string structures
  120.       STRUCTURE FileDatas,0
  121.          ULONG Str_File ; filename (null offset)
  122.          ULONG Dec_ULen ; unpacked
  123.          ULONG Dec_CLen ; packed
  124.          ULONG Str_Type ; compression format
  125.          ULONG Dec_Ratio ; compression ratio
  126.          ULONG Str_Comment ; file comments
  127.          LABEL strlen ; max lenght for the output string above
  128.  
  129.       STRUCTURE Totals,0
  130.          ULONG Tot_numf
  131.          ULONG Tot_utot2
  132.          ULONG Tot_ctot2
  133.          ULONG Tot_ratio
  134.          LABEL Tot_strlen2
  135.  
  136. numfbuff = 16
  137.  
  138. tot2 = (vars_sizeof+fib_SIZEOF+lha_size+strlen)
  139. totalbuffer  = (tot2+Tot_strlen2+numfbuff)
  140. VARSIZE        equ    8
  141. FILE        equ    1
  142.  
  143. ;reg. usage
  144. ; a6=mainly dosbase ;a5=args ;a4=utilitybase ;a3=membase (and dosbase)
  145. ; a2=output buffer ; d7=filehandle ; d6=lock ; d5=filename ; d4=fib
  146.  
  147.  
  148.     section    xlist,code
  149. init__
  150.     move.l    4.w,a6
  151.     lea    dosname(pc),a1
  152.     moveq    #36,d0
  153.     CALL    OpenLibrary
  154.     move.l    d0,a5 ;         a5= temp dosbase
  155.     bne.s    allocmem
  156.  
  157.     moveq    #122,d0 ; invalid resident library
  158.     rts
  159.  
  160.  
  161. allocmem    ; only one alloc for the 4 arrays
  162.     move.l    #totalbuffer,d0
  163.     move.l    #$10001,d1 ; (MEMF_PUBLIC!MEMF_CLEAR)
  164.     CALL    AllocVec
  165.     move.l    d0,a3 ; d0 will contain the start location of each array
  166.     beq    close_dos
  167.  
  168.     ; for the FileInfoBlock d0=location
  169.     add.l    #vars_sizeof,d0 ; Fib goes after main vars data
  170.     move.l    d0,d4 ;            d4=Fib (FileInfoBlock)
  171.  
  172.     ; for the XpkHeader
  173.     add.l    #fib_SIZEOF,d0 ; Readbuffer goes after Fib
  174.     move.l    d0,headbuf(a3)
  175.  
  176.     ; for our output buffer
  177.     add.l    #lha_size,d0 ; last but not least the output buffer
  178.     move.l    d0,a2 ;         a2=output buffer
  179.  
  180.     add.l    #strlen,d0
  181.     move.l    d0,strloc2(a3)
  182.  
  183.     add.l    #Tot_strlen2,d0
  184.     move.l    d0,numfiles_buffer(a3)
  185.  
  186. open_utility
  187.     lea    uname(pc),a1
  188.     moveq    #36,d0
  189.     CALL    OpenLibrary
  190.     move.l    a5,a6 ;         now a6=dosbase until exit
  191.     move.l    d0,a4 ; a4=utilitybase
  192.     beq    free_mem
  193.  
  194.     CALL    Output
  195.     move.l    d0,ofh(a3)
  196.  
  197. readargs
  198.     lea    args_template(pc),a0
  199.     move.l    a0,d1
  200.     lea    dirs(a3),a0
  201.     move.l    a0,d2
  202.     moveq    #0,d3
  203.     CALL    ReadArgs
  204.     move.l    d0,(a3) ; =0(a3)=args_result(a3)
  205.     not.l    switch10(a3) ; Finally H2 becomes the def output !
  206.  
  207. test_tr
  208.     tst.l    switch3(a3) ; TESTRIPP
  209.     beq    test_td
  210.     lea    tr.msg(pc),a0
  211.     move.l    a0,d1
  212.     CALL    PutStr
  213. test_td
  214.     tst.l    switch4(a3) ; TESTDURATION
  215.     beq    test_sw1
  216.     lea    td.msg(pc),a0
  217.     move.l    a0,d1
  218.     CALL    PutStr
  219.  
  220. test_sw1
  221.     move.l    switch1(a3),d1 ; INTROTEXT
  222.     beq    testsort1
  223.  
  224.     bsr    type ; write your intro text
  225.  
  226. testsort1
  227.     tst.l    switch6(a3) ; NOSORT
  228.     bne    giveargs
  229.  
  230.  
  231. findseg ; if Sort is not yet resident
  232.     lea    segname(pc),a0
  233.     move.l    a0,d1
  234.     moveq    #0,d2
  235.     moveq    #0,d3
  236.     CALL    FindSegment ; is Sort already resident ?
  237.     tst.l    d0
  238.     bne    giveargs ; yep, exit
  239.  
  240.     lea    cmdname(pc),a0
  241.     move.l    a0,d1
  242.     CALL    LoadSeg ; load code from c:Sort
  243.     tst.l    d0
  244.     bne    sortloaded
  245.  
  246.     move.l    #1,switch6(a3) ; unable to load c:Sort, activating NOSORT
  247.     bra.s    giveargs
  248.  
  249. sortloaded
  250.     move.l    d0,d2
  251.     lea    segname(pc),a0
  252.     move.l    a0,d1
  253.     moveq    #1,d3
  254.     CALL    AddSegment ; make it resident
  255.  
  256. giveargs
  257.     move.l    dirs(a3),a0
  258.     move.l    a0,a5 ; save dirs array
  259.     move.l    (a5)+,d1 ; if a5 is null, no arg -> current dir is locked
  260.     bne.s    lockfile ; branch if args
  261.  
  262.     move.l    d1,-(a5) ; if no arg was given, back to the old state
  263.  
  264. lockfile ;         lock for Examine().
  265.     move.l    d1,-(sp) ; push dirname
  266.     moveq    #ACCESS_READ,d2
  267.     CALL    Lock
  268.     move.l    d0,d6 ;         d6=lock on dir to scan
  269.     beq.s    errlock ; branch to scan the dir, else...
  270.  
  271.     tst.l    switch7(a3) ; NOHEADER
  272.     beq    examine
  273.     bra    testsort
  274.  
  275.  
  276. errlock
  277.     CALL    IoErr ; get the error
  278.     move.l    d0,d1
  279.     moveq    #0,d2
  280.     CALL    PrintFault ; output an error msg, then exit
  281.     move.l    (sp)+,d1 ; pull dirname (to avoid crash at RTS)
  282.  
  283. free_args
  284.     tst.b    tmpdeleted(a3) ; close+del tmpfile if break
  285.     beq    free_args2
  286.  
  287.     lea    tmpname(pc),a0
  288.     move.l    a0,d1
  289.     move.l    #ACCESS_READ,d2
  290.     CALL    Lock
  291.     tst.l    d0
  292.     beq    free_args2
  293.  
  294.     move.l    d0,d1
  295.     CALL    UnLock
  296.  
  297.     move.l    tmpfh(a3),d1
  298.     CALL    Close
  299.  
  300.     lea    tmpname(pc),a0
  301.     move.l    a0,d1
  302.     CALL    DeleteFile
  303.  
  304. free_args2
  305.     tst.l    switch11(a3) ; LF
  306.     beq    noelf
  307.  
  308.     bsr    linefeed
  309.     bsr    linefeed
  310.  
  311. noelf
  312.     move.l    (a3),d1 ; =args_result(a3)
  313.     CALL    FreeArgs
  314.  
  315. close_util
  316.     move.l    a4,a1
  317.     move.l    4.w,a6
  318.     CALL    CloseLibrary
  319.  
  320. free_mem
  321.     move.l    a3,a1
  322.     move.l    a6,a5
  323.     move.l    4.w,a6
  324.     CALL    FreeVec
  325.  
  326. close_dos
  327.     move.l    a5,a1
  328.     move.l    4.w,a6
  329.     CALL    CloseLibrary
  330.     moveq    #0,d0
  331.     rts ; ----------------------- exit
  332.  
  333.  
  334. examine        ; to get the comments and the crunched size
  335.     lea    delim(pc),a0
  336.     bsr    wdelim
  337.     clr.w    namegiv_bool(a3)
  338.     move.l    (sp),a0
  339.     tst.b    (a0)
  340.     bne    findend
  341.  
  342.     move.w    #1,namegiv_bool(a3)
  343.  
  344. findend
  345.     tst.b    (a0)+
  346.     bne.s    findend
  347.     lea    -2(a0),a0
  348.     cmpi.b    #'/',(a0)
  349.     bne.s    filepart
  350.     clr.b    (a0) ; erase last '/' for good filepart (only dirname)
  351. filepart
  352.     cmpi.b    #':',(a0)
  353.     bne.s    fp2
  354.     clr.b    (a0)
  355. fp2
  356.     tst.l    switch9(a3)
  357.     bne    fullpath
  358.     move.l    (sp)+,d1 ; pull dirname
  359.     CALL    FilePart
  360.     move.l    d0,-(sp) ; push dirname
  361. fullpath
  362.     tst.l    switch10(a3)
  363.     bne    nostars
  364.  
  365.     lea    stars(pc),a0
  366.     move.l    a0,d1
  367.     CALL    PutStr ; put '******'
  368. nostars
  369.     move.l    d6,d1 ; get lock
  370.     move.l    d4,d2
  371.     CALL    Examine
  372.     tst.l    d0
  373.     beq    exnext
  374.  
  375. good
  376.     tst.w    namegiv_bool(a3)
  377.     bne    nonamegiven
  378.  
  379.     move.l    (sp),d1
  380.     bra.s    namegiven
  381.  
  382. nonamegiven
  383.     move.l    d4,a0
  384.     lea    fib_FileName(a0),a1
  385.     move.l    a1,d1
  386.  
  387. namegiven
  388.     tst.l    switch10(a3)
  389.     beq    nocenter
  390.     bsr    centersub
  391.  
  392. nocenter
  393.     CALL    PutStr
  394.     move.l    d4,a0
  395.     lea    fib_Comment(a0),a0
  396.     tst.b    (a0)
  397.     beq.s    nodircomms
  398.  
  399. sel_headerfmt
  400.  
  401.     tst.l    switch10(a3)
  402.     beq    hfmt1
  403.  
  404.     move.l    a0,-(sp) ; save comments
  405.     bsr    linefeed
  406.     bra    putcomms
  407.  
  408. hfmt1
  409.     move.l    a0,-(sp)
  410.     lea    inter(pc),a1
  411.     move.l    a1,d1
  412.     CALL    PutStr
  413. putcomms
  414.     move.l    (sp)+,a0
  415.     move.l    a0,d1
  416.     tst.l    switch10(a3)
  417.     beq    nocentercomms
  418.     bsr    centersub
  419. nocentercomms
  420.     CALL    PutStr
  421.  
  422. nodircomms
  423.     tst.l    switch6(a3)
  424.     bne    twolf
  425.  
  426.     tst.l    switch10(a3)
  427.     bne    onelf
  428.  
  429. twolf
  430.     bsr    linefeed
  431.  
  432. onelf
  433.     tst.l    switch10(a3)
  434.     bne    nolim2
  435.  
  436.     lea    delim(pc),a0
  437.     bsr    wdelim
  438. nolim2
  439.  
  440.     bsr    linefeed
  441.     move.l    ofh(a3),d1
  442.     CALL    Flush
  443.  
  444. testsort
  445.     tst.l    switch6(a3)
  446.     bne    currentdir
  447.  
  448. opentmp
  449.     lea    tmpname(pc),a0
  450.     move.l    a0,d1
  451.     move.l    #MODE_NEWFILE,d2
  452.     CALL    Open
  453.     move.l    d0,tmpfh(a3)
  454.     beq.s    clrsort
  455.     move.b    #1,tmpdeleted(a3)
  456.     bra.s    currentdir
  457.  
  458. clrsort
  459.     move.b    #1,switch6(a3)
  460.  
  461. currentdir
  462.     move.l    (sp)+,a0
  463.     move.l    d6,d1
  464.     CALL    CurrentDir
  465.     move.l    d0,oldlock(a3) ; oldlock on prev dir
  466.     move.l    d6,d1 ;     d6=lock on dir to scan
  467.     move.l    d4,d2
  468.     CALL    Examine
  469.     tst.l    d0
  470.     beq.s    loop ; if error, unlock and try next arg
  471.  
  472.     move.l    d4,a0
  473.     move.l    fib_DirEntryType(a0),d0
  474.     bgt    exnext ; scan only if d0 > 0 (entry is a dir)
  475.  
  476.  
  477. loop
  478.     bsr.s    unlockdir
  479. loop2
  480.  
  481.     move.l    (a5)+,d1 ; get the next arg
  482.     bne    gotonext ; continue if arg found
  483.  
  484. nomore
  485.     move.l    switch5(a3),d1
  486.     beq    free_args
  487.     bsr    type
  488.     bra    free_args ; no more args, exit
  489.  
  490.  
  491. gotonext
  492.     move.l    d1,-(sp)
  493.     bsr    linefeed
  494.     bsr    linefeed
  495.     move.l    (sp)+,d1
  496.     bra    lockfile
  497.  
  498. unlockdir
  499.     move.l    oldlock(a3),d1
  500.     CALL    CurrentDir
  501.     move.l    d0,d1
  502.     CALL    UnLock
  503.     rts
  504.  
  505.  
  506. dirempty
  507.     lea    delim(pc),a0
  508.     bsr    wdelim
  509.     lea    empty.msg(pc),a0
  510.     move.l    a0,d1
  511.     CALL    PutStr
  512.  
  513.     move.l    tmpfh(a3),d1
  514.     beq    deltmp2
  515.  
  516.     CALL    Close
  517.  
  518. deltmp2
  519.     lea    tmpname(pc),a0
  520.     move.l    a0,d1
  521.     CALL    DeleteFile
  522.     bra    free_args2
  523.  
  524. noexnext
  525.     bsr.s    unlockdir
  526.     tst.b    atleastone(a3)
  527.     beq    dirempty
  528.  
  529. ins_totfiles
  530.     tst.l    switch6(a3)
  531.     bne    notmpclose
  532.  
  533.     tst.l    switch10(a3)
  534.     beq.s    noftot
  535.  
  536.     tst.l    switch7(a3)
  537.     bne.s    noftot
  538.  
  539.     move.l    strloc2(a3),a1
  540.     tst.l    switch13(a3)
  541.     bne.s    dontadd
  542.  
  543.     move.l    numdirs(a3),d0
  544.     add.l    d0,numfiles(a3)
  545.  
  546. dontadd
  547.     lea    fmtnum(pc),a0
  548.     tst.b    onlydirs(a3)
  549.     bne.s    keepfmt
  550.  
  551.     lea    fmtdnum(pc),a0
  552.  
  553. keepfmt
  554.     move.l    numfiles(a3),(a1)
  555.     tst.l    switch13(a3)
  556.     beq    dontchangenum
  557.     tst.b    onlydirs(a3)
  558.     bne    dontchangenum
  559.  
  560.     move.l    numdirs(a3),(a1)
  561.  
  562. dontchangenum
  563.     movem.l    a2/a3/a6,-(sp)
  564.     move.l    numfiles_buffer(a3),a3
  565.     bsr    sprintf
  566.     movem.l    (sp)+,a2/a3/a6
  567.     move.l    numfiles_buffer(a3),d1
  568.     bsr    centersub
  569.     CALL    PutStr
  570.     bsr    linefeed
  571.  
  572. limafthead
  573.     lea    delim(pc),a0
  574.     bsr    wdelim
  575.  
  576. nolim1
  577.     bsr    linefeed
  578.     move.l    ofh(a3),d1
  579.     CALL    Flush
  580.  
  581. noftot
  582.     tst.l    switch10(a3)
  583.     bne    doneyet
  584.     move.l    strloc2(a3),a1
  585.     tst.l    switch13(a3)
  586.     bne.s    doneyet
  587.  
  588.     move.l    numdirs(a3),d0
  589.     add.l    d0,numfiles(a3)
  590.  
  591. doneyet
  592.     move.l    tmpfh(a3),d1
  593.     beq    notmpclose
  594.     CALL    Close
  595.  
  596.     tst.b    sortflag(a3)
  597.     beq.s    notmpclose
  598.  
  599.     moveq    #0,d2
  600.     move.l    d2,d3
  601.     lea    comline(pc),a0
  602.     move.l    a0,d1
  603.     CALL    Execute
  604.  
  605. type_files
  606.     lea    sortedname(pc),a0
  607.     move.l    a0,d1
  608.     bsr    type
  609.     tst.l    d0
  610.     bne.s    notmpclose
  611.  
  612.     lea    sortedname(pc),a0
  613.     move.l    a0,d1
  614.     CALL    DeleteFile
  615. deltmp
  616. ;    clr.b    fileshere(a3)
  617.     lea    tmpname(pc),a0
  618.     move.l    a0,d1
  619.     CALL    DeleteFile
  620.  
  621.     clr.b    tmpdeleted(a3)
  622.  
  623. notmpclose
  624.     tst.l    switch2(a3)
  625.     bne    loop2
  626.  
  627. noloop2
  628.     move.l    strloc2(a3),a1
  629.     move.l    numfiles(a3),(a1)
  630.  
  631.     tst.b    onlydirs(a3)
  632.     bne    ftot
  633.  
  634.     move.l    numdirs(a3),(a1)
  635.     move.l    a1,d2
  636.     lea    totdirfmt(pc),a0 ; the format
  637.     move.l    a0,d1
  638.     CALL    VPrintf ; printing the final string
  639.  
  640.     move.l    ofh(a3),d1
  641.     CALL    Flush
  642.  
  643.     bra    wxltot
  644.  
  645. ftot
  646.     move.l    utot(a3),Tot_utot2(a1)
  647.     move.l    ctot(a3),Tot_ctot2(a1)
  648.     tst.l    Tot_utot2(a1)
  649.     bne.s    nonull
  650.     moveq    #0,d2
  651.     bra.s    wtot
  652.  
  653. nonull
  654.     move.l    Tot_utot2(a1),d3
  655.     move.l    ctot(a3),d0
  656.  
  657.     bsr    calc_ratio ; in: d3=utot,d0=ctot / out: d2=ratio
  658.  
  659. wtot
  660.     move.l    d2,Tot_ratio(a1) ; ratio=100-100*CLen/ULen
  661.     move.l    a1,d2
  662.     lea    totfmt(pc),a0 ; the format
  663.     move.l    a0,d1
  664.     CALL    VPrintf ; printing the final string
  665.  
  666.     move.l    ofh(a3),d1
  667.     CALL    Flush
  668.  
  669. wxltot
  670.     move.l    #MODE_NEWFILE,d2
  671.     lea    totvarname(pc),a0
  672.     move.l    a0,d1
  673.     CALL    Open
  674.     move.l    d0,varfh(a3)
  675.     move.l    d0,d1
  676.  
  677.     move.l    strloc2(a3),d3
  678.     tst.b    onlydirs(a3)
  679.     bne    notonlyd
  680.  
  681.     tst.l    switch13(a3)
  682.     beq    notonlyd
  683.     move.l    strloc2(a3),a0
  684.     clr.l    (a0)
  685.  
  686. notonlyd
  687.     lea    fmtvar(pc),a0
  688.     move.l    a0,d2
  689.     CALL    VFWritef
  690.     move.l    varfh(a3),d1
  691.     CALL    Close
  692.  
  693.     bsr    dosumvar
  694.  
  695. clrintvars
  696.     moveq    #0,d0
  697.     move.l    d0,utot(a3)
  698.     move.l    d0,ctot(a3)
  699.     move.l    d0,numfiles(a3)
  700.     move.l    d0,numdirs(a3)
  701.     bra    loop2
  702.  
  703.  
  704. isdir ; called when filename was a dir
  705.     move.l    d4,a0
  706.     move.l    fib_DirEntryType(a0),d0
  707.     ble.s    exnext
  708.  
  709.     tst.l    switch8(a3)
  710.     bne.s    exnext
  711.  
  712.     clr.b    entrytype(a3)
  713.     lea    fib_FileName(a0),a1
  714.     move.l    a1,(a2)
  715.     move.l    #'Dir ',Packlib(a3)
  716.     lea    Packlib(a3),a1
  717.     move.l    a1,Str_Type(a2)
  718.     clr.l    Dec_Ratio(a2)
  719.     add.l    #1,numdirs(a3)
  720.     bra    testsort2
  721.  
  722. ;************  mainloop
  723.  
  724. exnext
  725.     move.l    #SIGBREAKF_CTRL_C,d1 ; check for ctrl-c between each file.
  726.     CALL    CheckSignal
  727.     tst.l    d0
  728.     beq.s    no_break
  729.  
  730. exit
  731.     bsr    unlockdir
  732.     bra    free_args
  733.  
  734.  
  735. no_break
  736.     move.l    d6,d1 ; d6=lock
  737.     move.l    d4,d2 ; d4=fib
  738.     CALL    ExNext
  739.     tst.l    d0
  740.     beq    noexnext ; break if error (like no more entries)
  741.  
  742.  
  743.     move.l    d4,a0
  744.     lea    fib_FileName(a0),a1
  745.     move.l    a1,d5 ;         d5=file to open
  746.     move.l    fib_Size(a0),Dec_CLen(a2)
  747.     move.l    fib_Size(a0),Dec_ULen(a2) ; ulen=clen for normal files
  748.     lea    fib_Comment(a0),a1
  749.     tst.l    switch3(a3)
  750.     beq.s    cmp_dur
  751.  
  752.     moveq    #25,d0
  753. rip
  754.     cmpi.l    #'Ripp',(a1,d0)
  755.     beq.s    cmp_dur
  756.     dbra    d0,rip
  757.     bra.s    exnext
  758.  
  759.  
  760. cmp_dur
  761.     tst.l    switch4(a3)
  762.     beq.s    cmp_xfh
  763.  
  764.     moveq    #2,d0
  765. dur
  766.     cmpi.b    #'[',(a1,d0)
  767.     beq.s    exnext
  768.     dbra    d0,dur
  769.  
  770.  
  771. cmp_xfh
  772.     cmpi.l    #'XFH ',(a1) ; detects XFH comments (by xScan). 'Erase' them.
  773.     bne.s    readhead
  774.  
  775. hide_comments__
  776.     clr.b    (a1)
  777.  
  778. readhead    ; lets read the first 16 bytes
  779.     move.l    a1,Str_Comment(a2)
  780.     move.l    d5,d1
  781.     move.l    #MODE_OLDFILE,d2
  782.     CALL    Open
  783.     move.l    d0,d7 ;         d7=filehandle#1
  784.     beq    isdir ; if error (dir) examine next entry
  785.  
  786.     move.b    #FILE,entrytype(a3)
  787.     move.b    #1,onlydirs(a3)
  788.     move.l    d0,d1
  789.     move.l    headbuf(a3),d2
  790.     move.l    d2,a1 ; clear the readbuffer because old infos are...
  791.     clr.l    (a1) ; ...still here. (Ex. if <.file> detected just before)
  792.     moveq    #lha_size,d3
  793.     CALL    Read
  794.     move.l    d7,d1
  795.     CALL    Close
  796.  
  797. testxpk__
  798.     move.l    headbuf(a3),a1 ;         a1=readbuffer
  799.     move.l    (a1),d1 ; =xh_Reco(a1)        d1=first 4 bytes of the file
  800.     cmpi.l    #'XPKF',d1
  801.     bne.s    testpp20
  802.  
  803. hereisxpk__
  804.     tst.l    switch14(a3)
  805.     beq    nosong
  806.  
  807.     lea    xh_Sample(a1),a0
  808.     move.l    a0,Str_File(a2)
  809.     moveq    #$1f,d0
  810.     moveq    #4,d1
  811.  
  812. .loop
  813.     cmp.b    (a0,d1),d0
  814.     bge    nosong
  815.     dbra    d1,.loop
  816.  
  817.     move.l    #$80,d0
  818.     moveq    #15,d1
  819.  
  820. .loop2
  821.     cmp.b    (a0,d1),d0
  822.     bge    nosong
  823.     dbra    d1,.loop2
  824.  
  825.     move.w    #1,xpked(a3)
  826.  
  827. nosong
  828.     move.l    xh_CLen(a1),d0
  829.     addq    #8,d0
  830.     cmp.l    Dec_CLen(a2),d0
  831.     bne    noxpk
  832.     move.l    xh_ULen(a1),Dec_ULen(a2) ; Unpacked lenght
  833.     move.l    xh_Type(a1),Packlib(a3) ; Packing method
  834.  
  835.     bra    print ; output to stdio
  836.  
  837. noxpk
  838.     move.l    #'!XPK',Packlib(a3)
  839.     bra    print
  840.  
  841. testpp20
  842.     move.l    d1,Packlib(a3) ; Packlib=PP20,Crm2 or S404
  843.     cmpi.l    #'PP20',d1
  844.     bne.s    testcrm2
  845.  
  846. hereispp20__        ; reopen file for decrunched size
  847.     move.l    d5,d1
  848.     move.l    #MODE_OLDFILE,d2
  849.     CALL    Open
  850.     move.l    d0,d7 ;         d7=filehandle#2
  851.     beq    exnext
  852.  
  853.     move.l    d0,d1
  854.     moveq    #-4,d2
  855.     moveq    #OFFSET_END,d3 ; position : before last longword
  856.     CALL    Seek
  857.     move.l    d7,d1
  858.     lea    pplast(a3),a0
  859.     move.l    a0,d2
  860.     moveq    #4,d3
  861.     CALL    Read ; let's read the last 4 bytes
  862.     move.l    d7,d1
  863.     CALL    Close
  864.     move.l    pplast(a3),d0 ; XXXXXXxx
  865.     lsr.l    #8,d0 ; calculating the PP-Decrunch-Info
  866.     move.l    d0,Dec_ULen(a2) ; 00XXXXXX
  867.     cmp.l    Dec_CLen(a2),d0
  868.     blt    nopp
  869.  
  870.     move.l    Dec_CLen(a2),d1
  871.     move.l    d1,d2
  872.     add.l    d1,d1 ; C*2
  873.     add.l    d1,d1 ; C*4
  874.     add.l    d1,d2 ; C*5
  875.     add.l    d2,d2 ; C*10
  876.     cmp.l    d2,d0
  877.     blt    print
  878.  
  879. nopp
  880.     move.l    Dec_CLen(a2),Dec_ULen(a2)
  881.     move.l    #'!PP2',Packlib(a3)
  882.     bra    print
  883.  
  884. testcrm2
  885.     cmpi.l    #'Crm2',d1
  886.     beq.s    hereiscrm
  887.     cmpi.l    #'CrM2',d1
  888.     beq.s    hereiscrm
  889.     cmpi.l    #'CrM!',d1
  890.     beq.s    hereiscrm
  891.     cmpi.l    #'Crm!',d1
  892.     bne.s    teststc
  893.  
  894. hereiscrm
  895.     move.l    crm_CrunchLen(a1),d0
  896.     add.l    #14,d0
  897.     cmp.l    Dec_CLen(a2),d0
  898.     bne.s    nocrm
  899.     move.l    crm_UnpackLen(a1),Dec_ULen(a2)
  900.     bra    print
  901.  
  902. nocrm
  903.     move.l    #'!Crm',Packlib(a3)
  904.     bra    print
  905.  
  906. teststc
  907.     cmpi.l    #'S403',d1
  908.     beq.s    hereisstc
  909.  
  910.     cmpi.l    #'S404',d1
  911.     bne.s    testlha
  912.  
  913. hereisstc
  914.     move.l    stc_CrunchLen(a1),d0
  915.     add.l    #20,d0
  916.     cmp.l    Dec_CLen(a2),d0
  917.     bne.s    nostc
  918.     move.l    stc_UnpackLen(a1),Dec_ULen(a2)
  919.     bra    print
  920.  
  921. nostc
  922.     move.l    #'!S40',Packlib(a3)
  923.     bra    print
  924.  
  925. testlha
  926.     move.l    headbuf(a3),a1
  927.     move.w    3(a1),d1
  928.     cmpi.w    #'lh',d1
  929.     bne    nopacker
  930.  
  931.     move.b    2(a1),d1
  932.     cmpi.b    #'-',d1
  933.     bne    nopacker
  934.  
  935. hereislh5
  936.     move.l    d4,-(sp)
  937.     bsr    getlhanfo
  938.     move.l    (sp)+,d4
  939.     bra    print
  940.  
  941. nopacker
  942.     move.l    #'    ',Packlib(a3)
  943.  
  944. print        ; put the infos in the right places
  945.     move.l    d5,d1
  946.     CALL    FilePart ; trash the full path, keep basename
  947.     tst.l    switch14(a3)
  948.     beq    putfilename
  949.  
  950.     tst.w    xpked(a3)
  951.     bne.s    printbis
  952.  
  953. putfilename
  954.     move.l    d0,(a2)
  955.  
  956. printbis
  957.     move.l    d0,a1
  958.     cmpi.b    #'.',(a1) ; strip out the ".*" files (.EPDir)
  959.     beq    exnext ; unlock and goto mainloop
  960.  
  961.     add.l    #1,numfiles(a3)
  962.     lea    Packlib(a3),a1
  963.     move.l    a1,Str_Type(a2)
  964.     move.l    Dec_CLen(a2),d0
  965.     move.l    Dec_ULen(a2),d3
  966.     add.l    d0,ctot(a3)
  967.     add.l    d3,utot(a3)
  968.  
  969.     bsr    calc_ratio
  970.  
  971.     move.l    d2,Dec_Ratio(a2) ; ratio=100-100*CLen/ULen
  972.  
  973.  
  974. testsort2
  975.     tst.l    switch6(a3)
  976.     bne    printfd
  977.     move.l    tmpfh(a3),fh(a3)
  978.     beq.s    printfd
  979.  
  980.     move.b    #1,sortflag(a3)
  981.     bra.s    vfprint
  982.  
  983.  
  984. printfd
  985.     move.l    ofh(a3),fh(a3)
  986.  
  987. vfprint
  988.     move.l    fh(a3),d1
  989.  
  990.     move.l    a2,d3
  991.     tst.b    entrytype(a3)
  992.     beq    putdirfmt
  993.  
  994.     lea    cformat(pc),a0
  995.     bra.s    dddd
  996.  
  997. putdirfmt
  998.     lea    dirfmt(pc),a0
  999.  
  1000. dddd
  1001.     move.l    a0,d2
  1002.     CALL    VFPrintf
  1003.     move.l    fh(a3),d1
  1004.     CALL    Flush
  1005.  
  1006.     move.l    d4,a0
  1007.     lea    fib_Comment(a0),a1
  1008.     moveq    #18,d0
  1009.  
  1010. clrcomm
  1011.     clr.l    (a1)+
  1012.     dbra    d0,clrcomm
  1013.     move.b    #1,atleastone(a3)
  1014.  
  1015.     clr.w    xpked(a3)
  1016.  
  1017.     bra    exnext ; next entry please
  1018.  
  1019. ;************************************************* subroutines
  1020.  
  1021.  
  1022. calc_ratio ; in: d0=ctot,d3=utot / out: d2=ratio
  1023.     move.l    a6,a0
  1024.     move.l    a4,a6
  1025.  
  1026.     tst.l    d3
  1027.     beq    dontcalc
  1028.  
  1029.     cmp.l    d0,d3 ; test if clen = ulen ( => ratio = 0% )
  1030.     bne.s    calc
  1031.  
  1032. dontcalc
  1033.     moveq    #0,d2
  1034.     bra.s    endcalc
  1035.  
  1036. calc
  1037.     moveq    #100,d1
  1038.     move.l    d0,d5
  1039.     move.l    d3,d0
  1040.     cmpi.l    #1000000,d3 ; change method at 1 Mb
  1041.     bgt.s    nozero ; bra if d3 is big enough for the "bigsizes" ratio
  1042.  
  1043.     move.l    d5,d0 ; classic method, for 0 => 21 Mo sizes
  1044.     CALL    UMult32 ; clen * 100 (oveflow with too big numbers!)
  1045.     move.l    d3,d1
  1046.     bra.s    div ; (clen * 100) / ulen
  1047.  
  1048. nozero ; 2nd method, for 1 Mb => 2 Gb (uncrunched) sizes
  1049.     CALL    UDivMod32 ; ulen / 100
  1050.     move.l    d0,d1
  1051.     move.l    d5,d0
  1052. div
  1053.     CALL    UDivMod32 ; clen / (ulen / 100)
  1054.     moveq    #100,d2
  1055.     sub.l    d0,d2 ; 100 - quotient = ratio
  1056. endcalc
  1057.     move.l    a0,a6
  1058.     rts
  1059.  
  1060.  
  1061. linefeed
  1062.     move.l    ofh(a3),d1
  1063.     moveq    #10,d2
  1064.     CALL    FPutC
  1065.     rts
  1066.  
  1067.  
  1068. type ; d1: strptr on file to write to stdout
  1069.     move.l    d1,-(sp)
  1070.     moveq    #ACCESS_READ,d2
  1071.     CALL    Lock
  1072.     move.l    d0,itlock(a3)
  1073.     bne.s    itlocked
  1074.     moveq    #-1,d0
  1075.     rts
  1076. itlocked
  1077.     move.l    d4,d2
  1078.     move.l    d0,d1
  1079.     CALL    Examine
  1080.     move.l    d4,a0
  1081.     move.l    fib_Size(a0),itsize(a3)
  1082.     move.l    #MODE_OLDFILE,d2
  1083.     move.l    (sp)+,d1
  1084.     CALL    Open
  1085.     move.l    d0,itfh(a3)
  1086.     bne.s    itopened
  1087.     bra    itunlock
  1088. itopened
  1089.     move.l    itsize(a3),d0
  1090.     move.l    #$10001,d1
  1091.     move.l    a6,-(sp)
  1092.     move.l    4.w,a6
  1093.     CALL    AllocVec
  1094.     move.l    (sp)+,a6
  1095.     move.l    d0,itbuffer(a3)
  1096.     beq    itclose
  1097.     move.l    d0,d2
  1098.     move.l    itfh(a3),d1
  1099.     move.l    itsize(a3),d3
  1100.     CALL    Read
  1101.     move.l    ofh(a3),d1
  1102.     move.l    itbuffer(a3),d2
  1103.     move.l    itsize(a3),d3
  1104.     CALL    Write
  1105.     move.l    itbuffer(a3),a1
  1106.     move.l    a6,-(sp)
  1107.     move.l    4.w,a6
  1108.     CALL    FreeVec
  1109.     move.l    (sp)+,a6
  1110. itclose
  1111.     move.l    itfh(a3),d1
  1112.     CALL    Close
  1113. itunlock
  1114.     move.l    itlock(a3),d1
  1115.     CALL    UnLock
  1116.     moveq    #0,d0
  1117.     rts
  1118.  
  1119.  
  1120. centersub ; d1=strptr on string to center (80 cols display)
  1121.     move.l    d1,-(sp)
  1122.     move.l    d1,a0
  1123.     moveq    #-1,d0
  1124.  
  1125. countlen
  1126.     addq    #1,d0
  1127.     tst.b    (a0)+
  1128.     bne.s    countlen
  1129.  
  1130.     moveq    #80,d1
  1131.     sub.b    d0,d1
  1132.  
  1133.     tst.b    d1
  1134.     bmi    endcenter
  1135.  
  1136.     tst.b    d1
  1137.     beq    endcenter
  1138.  
  1139.     lsr.l    #1,d1
  1140.     move.b    d1,spcecnt(a3)
  1141.     beq    endcenter
  1142.  
  1143. putspace
  1144.     move.l    ofh(a3),d1
  1145.     moveq    #' ',d2
  1146.     CALL    FPutC
  1147.     sub.b    #1,spcecnt(a3)
  1148.     tst.b    spcecnt(a3)
  1149.     bne    putspace
  1150. endcenter
  1151.     move.l    (sp)+,d1
  1152.     rts
  1153.  
  1154.  
  1155. dosumvar ; env:xlsumtot, sumvarfname
  1156.     lea    sumvarfname(pc),a0
  1157.     move.l    a0,d1
  1158.     moveq    #ACCESS_READ,d2
  1159.     CALL    Lock
  1160.     tst.l    d0
  1161.     bne    sdfg
  1162.  
  1163.     move.l    #MODE_NEWFILE,d2
  1164.     lea    sumvarfname(pc),a0
  1165.     move.l    a0,d1
  1166.     CALL    Open
  1167.     move.l    d0,varfh(a3)
  1168.     move.l    d0,d1
  1169.  
  1170.     move.l    strloc2(a3),d3
  1171.     lea    fmtvar(pc),a0
  1172.     move.l    a0,d2
  1173.     CALL    VFWritef
  1174.     move.l    varfh(a3),d1
  1175.     CALL    Close
  1176.     rts
  1177.  
  1178. sdfg ; nice label names !!!
  1179.     move.l    d0,d1
  1180.     CALL    UnLock
  1181.  
  1182.     moveq    #VARSIZE,d0
  1183.     move.l    #$10001,d1
  1184.     move.l    a6,-(sp)
  1185.     move.l    4.w,a6
  1186.     CALL    AllocVec
  1187.     move.l    (sp)+,a6
  1188.     tst.l    d0
  1189.     bne    vvdj
  1190.     rts
  1191.  
  1192. vvdj
  1193.     move.l    d0,sumvarbuff(a3)
  1194.     move.l    d0,d2
  1195.     moveq    #VARSIZE,d3
  1196.     lea    sumvarname(pc),a0
  1197.     move.l    a0,d1
  1198.     move.l    #GVF_GLOBAL_ONLY,d4
  1199.     CALL    GetVar
  1200.  
  1201.     move.l    sumvarbuff(a3),d1
  1202.     lea    longsum(a3),a0
  1203.     move.l    a0,d2
  1204.     CALL    StrToLong
  1205.  
  1206.     move.l    numfiles(a3),d0
  1207.  
  1208.     add.l    d0,longsum(a3)
  1209.  
  1210.     move.l    #MODE_NEWFILE,d2
  1211.     lea    sumvarfname(pc),a0
  1212.     move.l    a0,d1
  1213.     CALL    Open
  1214.     move.l    d0,varfh(a3)
  1215.     move.l    d0,d1
  1216.  
  1217.     lea    longsum(a3),a0
  1218.     move.l    a0,d3
  1219.     lea    fmtvar(pc),a0
  1220.     move.l    a0,d2
  1221.     CALL    VFWritef ; I don't use SetVar() here for strange reasons
  1222.     move.l    varfh(a3),d1
  1223.     CALL    Close
  1224.     rts
  1225.  
  1226. freevbuff
  1227.     move.l    sumvarbuff(a3),a1
  1228.     move.l    a6,-(sp)
  1229.     move.l    4.w,a6
  1230.     CALL    FreeVec
  1231.     move.l    (sp)+,a6
  1232.     rts
  1233.  
  1234.  
  1235. sprintf ; a0 - format, a1 - data, a3 - buffer
  1236.         lea    stuffChar(pc),a2
  1237.         move.l    4.w,a6
  1238.         CALL    RawDoFmt
  1239.         rts
  1240.  
  1241.     stuffChar:
  1242.         move.b    d0,(a3)+
  1243.         rts
  1244.  
  1245.  
  1246. wdelim ; a0 - strptr on line to write
  1247.     tst.l    switch12(a3)
  1248.     beq    wd_end
  1249.  
  1250.     move.l    a0,d1
  1251.     bsr    centersub
  1252.     CALL    PutStr
  1253.     move.l    ofh(a3),d1
  1254.     CALL    Flush
  1255.  
  1256. wd_end
  1257.     rts
  1258.  
  1259.  
  1260. getlhanfo
  1261.  
  1262.     moveq    #0,d4 ; index
  1263.  
  1264.     bsr    getlh_clen
  1265.  
  1266.     move.l    tmp_lhsize(a3),d0
  1267.     cmp.l    Dec_CLen(a2),d0
  1268.     blt    goodlha
  1269.  
  1270.     move.l    #'!LHA',Packlib(a3)
  1271.     rts
  1272.  
  1273. goodlha
  1274.     add.l    #45,d0
  1275.     cmp.l    Dec_CLen(a2),d0
  1276.     bgt    onefileinside
  1277.  
  1278. multiplelha
  1279.     move.l    #'LHAs',Packlib(a3)
  1280.     clr.l    lh_utot(a3)
  1281.  
  1282.     move.l    d5,d1
  1283.     move.l    #MODE_OLDFILE,d2
  1284.     CALL    Open
  1285.  
  1286.     move.l    d0,d7
  1287.     beq    unopenlha
  1288.  
  1289. refreshindex
  1290.     move.l    headbuf(a3),a1
  1291.     cmpi.w    #$2001,lha_chksum2(a1) ; whaw! I was lucky to find this.
  1292.     bne    amilha
  1293. uxlha
  1294.     addq    #3,d4
  1295.  
  1296. amilha
  1297.     moveq    #0,d0
  1298.     move.l    headbuf(a3),a1
  1299.     move.b    lha_namesize(a1),d0
  1300.     add.l    d0,d4
  1301.     move.l    d4,d0
  1302.  
  1303.     add.l    #24,d4 ; 24=size of checksum and other stuff.
  1304.     move.l    d4,d0
  1305.  
  1306.     add.l    tmp_lhsize(a3),d4 ; tmp_lhsize=clen of an arc file
  1307.     move.l    d4,d0
  1308.  
  1309.     bsr    getlh_ulen
  1310.  
  1311.     move.l    Dec_ULen(a2),d0
  1312.     add.l    d0,lh_utot(a3) ; lh_utot = total unpacked lenght of files
  1313.     move.l    lh_utot(a3),d0
  1314.  
  1315.  
  1316. readnextlha
  1317.  
  1318.     move.l    d7,d1
  1319.     move.l    d4,d2
  1320.     move.l    #OFFSET_BEGINNING,d3
  1321.     CALL    Seek ; go to the next lha header
  1322.     CALL    IoErr
  1323.     tst.l    d0
  1324.     beq    morelha
  1325.  
  1326. endlha
  1327.     move.l    d7,d1
  1328.     CALL    Close
  1329.  
  1330.     move.l    Dec_ULen(a2),d1
  1331.     sub.l    d1,lh_utot(a3)
  1332.     move.l    lh_utot(a3),Dec_ULen(a2)
  1333.     tst.l    Dec_ULen(a2)
  1334.     bpl    sizeplus
  1335.  
  1336. unopenlha
  1337.     move.l    Dec_CLen(a2),Dec_ULen(a2)
  1338. sizeplus
  1339.     rts
  1340.  
  1341. morelha
  1342.     move.l    d7,d1
  1343.     move.l    headbuf(a3),d2
  1344.     moveq    #lha_size,d3
  1345.     CALL    Read ; read the next lha header in archive
  1346.  
  1347.     move.l    headbuf(a3),a1
  1348.     bsr    getlh_clen
  1349.  
  1350.     bra    refreshindex
  1351.  
  1352. ;*----------------------------------
  1353. onefileinside
  1354.  
  1355. ;    move.l    tmp_lhsize(a3),Dec_CLen(a2)
  1356. ;this line above put the crunched size appearing in Lha. I choose not to
  1357. ;do this here but feel free to do it if you want.
  1358.  
  1359.     bsr    getlh_ulen
  1360.  
  1361.     move.l    #'LHA ',Packlib(a3)
  1362.  
  1363.     rts
  1364.  
  1365. getlh_clen ; d1=index -> clen in tmp_lhsize
  1366.     move.b    lha_clen3(a1),(tmp_lhsize+3)(a3)
  1367.     move.b    lha_clen2(a1),(tmp_lhsize+2)(a3)
  1368.     move.b    lha_clen1(a1),(tmp_lhsize+1)(a3)
  1369.     move.b    lha_clen0(a1),tmp_lhsize(a3)
  1370.     rts
  1371.  
  1372. getlh_ulen ; d1=index -> ulen in dec_ulen
  1373.     move.b    lha_ulen3(a1),(Dec_ULen+3)(a2)
  1374.     move.b    lha_ulen2(a1),(Dec_ULen+2)(a2)
  1375.     move.b    lha_ulen1(a1),(Dec_ULen+1)(a2)
  1376.     move.b    lha_ulen0(a1),Dec_ULen(a2)
  1377.     rts
  1378.  
  1379. ;subdebug
  1380. ;    move.l    a1,-(sp)
  1381. ;    move.l    d0,-(sp)
  1382. ;    lea    debug(pc),a0
  1383. ;    move.l    a0,d2
  1384. ;    move.l    d0,(a0)
  1385. ;    lea    debugfmt(pc),a0
  1386. ;    move.l    a0,d1
  1387. ;    CALL    VPrintf
  1388. ;    move.l    (sp)+,d0
  1389. ;    move.l    (sp)+,a1
  1390. ;    rts
  1391.  
  1392. ;---- datas ----
  1393.  
  1394. ;debug
  1395. ;    dc.l    0
  1396.  
  1397. ;debugfmt
  1398. ;    dc.b    'd0=%ld',10,0
  1399.  
  1400. ;header
  1401. ;    dc.b    'File                           Real   Packed Type/Ratio'
  1402. ;    dc.b    '     Comment',10
  1403. ;    dc.b    '~~~~                           ~~~~   ~~~~~~ ~~~~~~~~~~'
  1404. ;    dc.b    '     ~~~~~~~',10,0
  1405.  
  1406. cformat
  1407.     dc.b    '%-26.26s %8ld %8ld (%s/%2ld%%) %s',$a,0
  1408.  
  1409. ;File                           Real   Packed Type/Ratio     Comment
  1410.  
  1411. dirfmt
  1412.     dc.b    ' %-25.25s %8ld %8ld (%s/%2ld%%) %s',$a,0
  1413.  
  1414.  
  1415. totfmt
  1416.     dc.b    '                            ~~~~~~~  ~~~~~~~       ~~~~',10
  1417.     dc.b    '=> %5ld file(s)         %10ld %8ld       %2ld%%',10,0
  1418.  
  1419. totdirfmt
  1420.     dc.b    '~~~~~~~~~~~~',10,'=> %ld dirs',10,0
  1421.  
  1422. dosname
  1423.     dc.b    'dos.library',0
  1424.  
  1425. uname
  1426.     dc.b    'utility.library',0
  1427.  
  1428. empty.msg
  1429.     dc.b    'Directory is empty!',10,0
  1430.  
  1431. tr.msg
  1432.     dc.b    '(Filtering mods WITH "Ripp" in DOS_Comment)',10,0
  1433.  
  1434. td.msg
  1435.     dc.b    '(Filtering mods WITHOUT duration in DOS_Comment)',10,0
  1436.  
  1437. stars
  1438.     dc.b    '********** ',0
  1439.  
  1440. delim
  1441.     dc.b    '-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*'
  1442.     dc.b    '-*-*-*-*-*-*-*-*-*-',10,0
  1443.  
  1444. ; you can easily add another line to have differents chars for top/bottom
  1445. ; don't forget to adapt some of the "lea    delim(pc),a0" !
  1446.  
  1447. inter
  1448.     dc.b    ' - ',0
  1449.  
  1450. fmtvar
  1451.     dc.b    '%N',0
  1452.  
  1453. fmtnum
  1454.     dc.b    '%ld files',0
  1455.  
  1456. fmtdnum
  1457.     dc.b    '%ld dirs',0
  1458.  
  1459. totvarname
  1460.     dc.b    'ENV:xltotal',0
  1461.  
  1462. sumvarfname
  1463.     dc.b    'ENV:'
  1464. sumvarname
  1465.     dc.b    'xlsumtot',0
  1466.  
  1467. tmpname
  1468.     dc.b    'T:xltmp1',0
  1469.  
  1470. sortedname
  1471.     dc.b    'T:xltmp2',0
  1472.  
  1473. cmdname
  1474.     dc.b    'C:'
  1475. segname
  1476.     dc.b    'Sort',0
  1477.  
  1478. comline ; lame but true
  1479.     dc.b    'Sort >NIL: T:xltmp1 to T:xltmp2',0
  1480.  
  1481. version_string
  1482.     dc.b    '$VER: xList 1.04 (26.09.95) by ReeZ/Osmose',0
  1483.  
  1484. args_template
  1485.     dc.b    'DIR/M,IT=INTROTEXT/K,NT=NOTOTALS/S,TR=TESTRIPP/S,'
  1486.     dc.b    'TD=TESTDURATION/S,ET=ENDTEXT/K,NOSORT/S,NH=NOHEADER/S,'
  1487.     dc.b    'FO=FILESONLY/S,FP=FULLPATH/S,H2=HEADER2/S,LF/S,'
  1488.     dc.b    'DL=DRAWLIMITS/S,COF=COUNTONLYFILES/S,SN=SONGNAME/S',0
  1489.  
  1490.     end
  1491.  
  1492. ; Contact me for ANY reason (especially for module-swapping, hehe) :
  1493. ;Snail:  David Le Corfec            Email: ->  perret@diva.univ-mlv.fr
  1494. ;        57 rue C.J. Romain
  1495. ;        94170 Le Perreux           Prefered dating from 10-October 95 (?):
  1496. ;           - France -                   ->>>  lecorfec@merlin.univ-mlv.fr
  1497. ;                     -=: 100% aNSWeR! :=-
  1498.